import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'Home',
        component: () =>
            import ('../views/Home.vue'),
        children: [{
            path: '/',
            name: '首页 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Index')
        }, {
            path: '/echarts/index',
            name: 'ECharts - MMALL ADMIN',
            component: () =>
                import ('../components/ECharts/ECharts.vue')
        }, {
            path: '/chart/index',
            name: 'chart - MMALL ADMIN',
            component: () =>
                import ('../components/ECharts/Chart')
        }, {
            path: '/product/index',
            name: '商品管理 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Product')
        }, {
            path: '/product-category/index',
            name: '品类管理 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Category')
        }, {
            path: '/order/index',
            name: '订单管理 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Order')
        }, {
            path: '/user/index',
            name: '用户列表 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/User')
        }, {
            path: '/product/save',
            name: '商品管理 -- 添加商品 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Product/Add')
        }, {
            path: '/product/details',
            name: '商品管理 -- 商品详情 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Product/Details')
        }, {
            path: '/product/editor',
            name: '商品管理 -- 修改详情 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Product/Editor')
        }, {
            path: '/order/detail',
            name: '订单管理 -- 订单详情 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Order/Detail')
        }, {
            path: '/product-category/add',
            name: '品类管理 -- 添加品类 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Category/categoryAdd')
        }, {
            path: '/product-category/index/children',
            name: '品类管理 -- 查看子类 - MMALL ADMIN',
            component: () =>
                import ('../components/Home/Category/categoryDetail')
        }, {
            path: '/',
            redirect: "/product/index"
        }]
    },
    {
        path: '/login',
        name: '用户登录 - MMALL ADMIN',
        component: () =>
            import ('../views/Login.vue')
    }
]

const router = new VueRouter({
    routes
})

export default router